package com.skivingcloud.file.utils;

import java.io.File;
import java.util.Calendar;

/**
 * @author hushouquan
 * @since 2024/1/22
 */
public class FilePathUtil{
    public static String getFileFolder(String fileStore) {
        Calendar c = Calendar.getInstance();
        String year = c.get(Calendar.YEAR) + "";
        String month = (c.get(Calendar.MONTH) + 1) + "";
        String ss = fileStore.endsWith(File.separator) ? (fileStore + year + File.separator + month + File.separator) : (fileStore + File.separator + year + File.separator + month + File.separator);
        File dir = new File(ss);
        if (!dir.exists()) {
            // 判断目录是否存在
            dir.mkdirs();
        }
        return ss;
    }
}
